﻿using System;
using System.Linq;
using System.Xml.Linq;
using System.Collections.Generic;
using CodeCounsel.SharePoint.RibbonDesigner.ViewModel;

namespace CodeCounsel.SharePoint.RibbonDesigner.Model
{
    [XName("CommandUI", Namespaces.CommandUIText)]
    public class CommandUI
        : DomainElement
    {
        public Ribbon Ribbon
        {
            get { return Children.OfType<Ribbon>().FirstOrDefault(); }
        }

        public Templates Templates
        {
            get { return Children.OfType<Templates>().FirstOrDefault(); }
        }

        public CommandUI(XElement dataModel, DomainModelSource source)
            : base(dataModel, source)
        {
        }

        public CommandUI()
        {
            Children.Add(new Ribbon());
            Children.Add(new Templates());
        }
    }
}